package org.travel.api.travel.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
public class Hotel implements Serializable {
    private int hotelid;
    private String hotelName;
    private String hotelimg;
    private String hotelOtherImg;
    private int countryId;
    private int provinceId;
    private int cityId;
    private String hotelAddress;
    private String hotelDetails;
    private String hotelFacilities;
    private String hotelPolicy;
    private int dicId;
    private Timestamp hotelCreationDate;
    private Timestamp hotelModifyDate;

    private List<Room> roomList;

    private List<Comment> commentList;


    @OneToMany
    @JoinColumn(name = "productId")
    public List<Comment> getCommentList() {
        return commentList;
    }

    public void setCommentList(List<Comment> commentList) {
        this.commentList = commentList;
    }

    @OneToMany
    @JoinColumn(name = "hotelid")
    @JsonIgnore
    public List<Room> getRoomList() {
        return roomList;
    }

    public void setRoomList(List<Room> roomList) {
        this.roomList = roomList;
    }

    @Id
    @Column(name = "hotelid")
    public int getHotelid() {
        return hotelid;
    }

    public void setHotelid(int hotelid) {
        this.hotelid = hotelid;
    }

    @Basic
    @Column(name = "hotelName")
    public String getHotelName() {
        return hotelName;
    }

    public void setHotelName(String hotelName) {
        this.hotelName = hotelName;
    }

    @Basic
    @Column(name = "hotelimg")
    public String getHotelimg() {
        return hotelimg;
    }

    public void setHotelimg(String hotelimg) {
        this.hotelimg = hotelimg;
    }

    @Basic
    @Column(name = "hotelOtherImg")
    public String getHotelOtherImg() {
        return hotelOtherImg;
    }

    public void setHotelOtherImg(String hotelOtherImg) {
        this.hotelOtherImg = hotelOtherImg;
    }

    @Basic
    @Column(name = "countryId")
    public int getCountryId() {
        return countryId;
    }

    public void setCountryId(int countryId) {
        this.countryId = countryId;
    }

    @Basic
    @Column(name = "provinceId")
    public int getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(int provinceId) {
        this.provinceId = provinceId;
    }

    @Basic
    @Column(name = "cityId")
    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    @Basic
    @Column(name = "hotelAddress")
    public String getHotelAddress() {
        return hotelAddress;
    }

    public void setHotelAddress(String hotelAddress) {
        this.hotelAddress = hotelAddress;
    }

    @Basic
    @Column(name = "hotelDetails")
    public String getHotelDetails() {
        return hotelDetails;
    }

    public void setHotelDetails(String hotelDetails) {
        this.hotelDetails = hotelDetails;
    }

    @Basic
    @Column(name = "hotelFacilities")
    public String getHotelFacilities() {
        return hotelFacilities;
    }

    public void setHotelFacilities(String hotelFacilities) {
        this.hotelFacilities = hotelFacilities;
    }

    @Basic
    @Column(name = "hotelPolicy")
    public String getHotelPolicy() {
        return hotelPolicy;
    }

    public void setHotelPolicy(String hotelPolicy) {
        this.hotelPolicy = hotelPolicy;
    }

    @Basic
    @Column(name = "dicId")
    public int getDicId() {
        return dicId;
    }

    public void setDicId(int dicId) {
        this.dicId = dicId;
    }

    @Basic
    @Column(name = "hotelCreationDate")
    public Timestamp getHotelCreationDate() {
        return hotelCreationDate;
    }

    public void setHotelCreationDate(Timestamp hotelCreationDate) {
        this.hotelCreationDate = hotelCreationDate;
    }

    @Basic
    @Column(name = "hotelModifyDate")
    public Timestamp getHotelModifyDate() {
        return hotelModifyDate;
    }

    public void setHotelModifyDate(Timestamp hotelModifyDate) {
        this.hotelModifyDate = hotelModifyDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Hotel hotel = (Hotel) o;
        return hotelid == hotel.hotelid &&
                countryId == hotel.countryId &&
                provinceId == hotel.provinceId &&
                cityId == hotel.cityId &&
                dicId == hotel.dicId &&
                Objects.equals(hotelName, hotel.hotelName) &&
                Objects.equals(hotelimg, hotel.hotelimg) &&
                Objects.equals(hotelOtherImg, hotel.hotelOtherImg) &&
                Objects.equals(hotelAddress, hotel.hotelAddress) &&
                Objects.equals(hotelDetails, hotel.hotelDetails) &&
                Objects.equals(hotelFacilities, hotel.hotelFacilities) &&
                Objects.equals(hotelPolicy, hotel.hotelPolicy) &&
                Objects.equals(hotelCreationDate, hotel.hotelCreationDate) &&
                Objects.equals(hotelModifyDate, hotel.hotelModifyDate);
    }

    @Override
    public int hashCode() {

        return Objects.hash(hotelid, hotelName, hotelimg, hotelOtherImg, countryId, provinceId, cityId, hotelAddress, hotelDetails, hotelFacilities, hotelPolicy, dicId, hotelCreationDate, hotelModifyDate);
    }
}
